/**
 * @Date 2025/1/8 10:49
 * @Created by 衡盛永
 */

package org.example.deploy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.example.deploy.pojo.SysRole;
import org.springframework.stereotype.Repository;

@Repository
public interface SysRoleMapper extends BaseMapper<SysRole> {
    // 获取用户已分配的角色
    Integer getRoleIdByUserId(@Param("userId") Integer userId);

    // 删除已分配的角色
    boolean delAssignedRole(@Param("roleId") Integer roleId, @Param("userId") Integer userId);

    // 给用户分配角色
    boolean assignRole(@Param("roleId") Integer roleId, @Param("userId") Integer userId);
}
